﻿Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Imports System.Collections.Generic
Namespace Pic
    Public MustInherit Class clsBase
        Public Shared ConnectionString As String
        Shared Sub New()
            ConnectionString = ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString
        End Sub

#Region "Methods"
        Protected Shared Function ExecuteNonQuery(ByVal cmd As DbCommand) As Integer
            Return cmd.ExecuteNonQuery()
        End Function

        Protected Shared Function ExecuteReader(ByVal cmd As DbCommand) As IDataReader
            Return ExecuteReader(cmd, CommandBehavior.Default)
        End Function

        Protected Shared Function ExecuteReader(ByVal cmd As DbCommand, ByVal behavior As CommandBehavior) As IDataReader
            Return cmd.ExecuteReader(behavior)
        End Function

        Protected Shared Function ExecuteScalar(ByVal cmd As DbCommand) As Object
            Return cmd.ExecuteScalar()
        End Function
#End Region
    End Class
End Namespace
